<!-- 我的会议主页 -->
<template>
  <view class="content">
    <!-- 头部标题组件 -->
    <!-- <headline /> -->
    <!-- <image src="../../static/index/add.svg" class="add" @click="jumpAdd()" /> -->
    <!-- 显示时间 -->
    <view v-for="(i,key) in ListInfo">
      <view class='title'>
        <text class='today' v-if=" isToday(key) ">今天</text>
        <text class='todayDate'>{{ key }}</text>
      </view>
      <!-- 会议列表 -->
      <view class="meetingList-box" v-for="j in i">
        <!-- 具有点击事件的地方 -->
        <view class="meetingList" @click="jumpMeeting(j)">
          <view class="meeting-name">
            <text>{{ j.MeetingName }}</text>
            <view class="tag" v-if="isTag">
              <u-tag :text="AuditStatus(j)" plain size="mini" :type="tagType"></u-tag>
            </view>
          </view>
          <view class="time">
            <image src="../../static/allMeetingIcos/time.svg"></image>
            <text>{{ changeTime(j.MeetingBeginTime) }}</text>
          </view>
          <view class="person">
            <image src="../../static/allMeetingIcos/meeting.svg"></image>
            <text v-for="l in j.MeetingAttendee">{{ l }}</text>
          </view>
        </view>
      </view>
      <view style="height: 50rpx;"></view>
    </view>
  </view>
</template>

<script>
import {request} from "@/utils/request";
import timeUtil from "@/utils/timeUtil";
import funcUtil from '../../utils/funcUtil';

export default {
  data() {
    return {
      title: '',
      ListInfo: [],
      listInfo2: [],
      auditStatus: 0,
      isTag: true,
      tagType: ''
    }
  },
  onLoad() {

  },
  computed: {},
  methods: {
    changeTime(t) {
      return timeUtil.formatDateTimeMM(Number(t))
    },
    isToday(str) {
      return str === timeUtil.getFormattedDate()
    },
    // audit(code){
    //    code === 0 ? '':''
    // },
    //跳转到预约会议页面
    jumpAdd() {
      uni.navigateTo({
        url: '/pages/bookMeeting/bookMeeting'
      })
    },
    //跳转会议页面
    jumpMeeting(info) {
      uni.setStorageSync('Index-Information',info);
      uni.navigateTo({
        url: `/pages/meeting/meeting?id=${''}&MeetingRoomName=${''}&MeetingRoomLocation=${''}&LifeCycle=Not-Reviewed`
      })
    },
    // 获取会议列表数据接口
    getMeetingList() {
      let promise = request.indexList({
        type: 'all',
        userid: "3"// userid: uni.getStorageSync('UserInfo').userid
      });
      promise.then((res) => {
        this.ListInfo = res.data;
      });
    },
    AuditStatus(info){
        if(info.MeetingAuditStatus === 0){
          this.isTag = false;
          return ''
        }else if(info.MeetingAuditStatus === 1){
          this.isTag = true;
          this.tagType = 'warning';
          return '待审核'
        }else if(info.MeetingAuditStatus === 2){
          this.isTag = true;
          this.tagType = 'success';
          return '已审核'}

        return ''
    },
    //
    timeJudge() {

    }
  },
  created() {
    this.getMeetingList();
    funcUtil.executeWithIntervalAndLimit(3,1000,()=>{
      this.getMeetingList();
      this.timeJudge()});
  },

  components: {
    // headline
  }
}
</script>

<style>
@import "index.css";
</style>